//
//  MyContractContentTableViewCell.m
//  PropertyManager
//
//  Created by TNG on 2018/7/18.
//  Copyright © 2018年 Tng. All rights reserved.
//

#import "MyContractContentTableViewCell.h"

@implementation MyContractContentTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self creatUI];
    }
    return self;
}

-(void)creatUI{
    [self.contentView addSubview:self.nameLabel];
    [self.contentView addSubview:self.addressLabel];
    [self.contentView addSubview:self.areaLabel];
    [self.contentView addSubview:self.timeLabel];
}

-(void)send
{
    self.nameLabel.text = @"徐汇区B栋1b181租赁合同";
    self.addressLabel.text = @"城央畔湖而居 恒大悦府";
    self.areaLabel.text = @"租赁总面积：60㎡";
    self.timeLabel.text = @"合同有效期：2018-09-08 至 2019-09-08";
    
    if (1) {
        self.nameLabel.textColor = SFM51;
        self.addressLabel.textColor = SFM51;
        self.areaLabel.textColor = SFM51;
        self.timeLabel.textColor = SFM153;
    }else
    {
//        self.nameLabel.textColor = SFMColor(221, 221, 221);
//        self.addressLabel.textColor = SFMColor(221, 221, 221);
//        self.areaLabel.textColor = SFMColor(221, 221, 221);
//        self.timeLabel.textColor = SFMColor(221, 221, 221);
    }
}

-(UILabel *)nameLabel
{
    if (_nameLabel == nil) {
        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 19, WIDTH - 40, 21)];
        _nameLabel.font = font(18);
        _nameLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _nameLabel;
}

-(UILabel *)addressLabel
{
    if (_addressLabel == nil) {
        _addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 59, WIDTH - 40, 20)];
        _addressLabel.font = font(12);
        _addressLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _addressLabel;
}

-(UILabel *)areaLabel
{
    if (_areaLabel == nil) {
        _areaLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 81, WIDTH - 40, 20)];
        _areaLabel.font = font(12);
        _areaLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _areaLabel;
}

-(UILabel *)timeLabel
{
    if (_timeLabel == nil) {
        _timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 103, WIDTH - 40, 20)];
        _timeLabel.font = font(12);
        _timeLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _timeLabel;
}

-(void)sendMyContractModel:(MyContractModel *)model
{
    self.nameLabel.text = model.pactname;
    self.addressLabel.text = model.housename;
    self.areaLabel.text = [NSString stringWithFormat:@"租赁总面积：%@㎡",model.rentarea];
    self.timeLabel.text = [NSString stringWithFormat:@"合同有效期：%@ 至 %@",model.pactstartdate,model.pactenddate];
    
    if (model.count < 0) {
        self.nameLabel.textColor = SFM51;
        self.addressLabel.textColor = SFM51;
        self.areaLabel.textColor = SFM51;
        self.timeLabel.textColor = SFM153;
    }else
    {
        self.nameLabel.textColor = SFMColor(221, 221, 221);
        self.addressLabel.textColor = SFMColor(221, 221, 221);
        self.areaLabel.textColor = SFMColor(221, 221, 221);
        self.timeLabel.textColor = SFMColor(221, 221, 221);
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
